using AutoMapper;
using Pay.DTO;
using Pay.Data;
using Pay.IService;

namespace Pay.Service.AutoMapper
{
    public class UserGuessPlayingHisMapper : IStartupDto
    {
        private IMapperConfigurationExpression _cfg;
        public UserGuessPlayingHisMapper(IMapperConfigurationExpression cfg)
        {
            _cfg = cfg;
        }
        public void Execute()
        {
            Create();
        }
        protected virtual void Create()
        {
            _cfg.CreateMap<UserGuessPlayingHis, user_guess_playing_his_dto>()
                .ForMember(dest => dest.id, src => src.MapFrom(c => c.Id))
                .ForMember(dest => dest.user_id, src => src.MapFrom(c => c.UserId))
                .ForMember(dest => dest.playing_id, src => src.MapFrom(c => c.PlayingId))
                .ForMember(dest => dest.guess_team_id, src => src.MapFrom(c => c.GuessTeamId))
                .ForMember(dest => dest.guess_num, src => src.MapFrom(c => c.GuessNum))
                .ForMember(dest => dest.consume_red_drill, src => src.MapFrom(c => c.ConsumeRedDrill))
                .ForMember(dest => dest.get_red_drill, src => src.MapFrom(c => c.GetRedDrill))
                .ForMember(dest => dest.create_time, src => src.MapFrom(c => c.CreateTime))
                .ForMember(dest => dest.merchant, src => src.MapFrom(c => c.Merchant))
                .ForMember(dest => dest.playing, src => src.MapFrom(c => c.Playing))
                .ForMember(dest => dest.guess_team, src => src.MapFrom(c => c.GuessTeam));


            _cfg.CreateMap<user_guess_playing_his_dto, UserGuessPlayingHis>()
                .ForMember(dest => dest.Id, src => src.MapFrom(c => c.id))
                .ForMember(dest => dest.UserId, src => src.MapFrom(c => c.user_id))
                .ForMember(dest => dest.PlayingId, src => src.MapFrom(c => c.playing_id))
                .ForMember(dest => dest.GuessTeamId, src => src.MapFrom(c => c.guess_team_id))
                .ForMember(dest => dest.GuessNum, src => src.MapFrom(c => c.guess_num))
                .ForMember(dest => dest.ConsumeRedDrill, src => src.MapFrom(c => c.consume_red_drill))
                .ForMember(dest => dest.GetRedDrill, src => src.MapFrom(c => c.get_red_drill))
                .ForMember(dest => dest.CreateTime, src => src.MapFrom(c => c.create_time));


        }
    }
}
